package com.adam.management.service.impl;

import com.adam.management.mapper.UserMapper;
import com.adam.management.model.UserDTO;
import com.adam.management.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * @projectName: adam-management-system
 * @description:
 * @author: Adam
 * @create: 2019-11-30 16:03
 **/

@Service
public class UserServiceImpl implements UserService {

   @Resource
    UserMapper userMapper;

    @Override
    public UserDTO findUserByUserId(String userId) {

        Map paramMap = new LinkedHashMap();
        paramMap.put("user_id",userId);
        List<UserDTO> userList =  userMapper.selectByMap(paramMap);
        if (userList!=null&&userList.size()==1){
            return userList.get(0);
        }
        return null;
    }
}
